﻿using System;
using System.Data;
using System.Collections.Generic;
using OgilvyOne.Model;
using OgilvyOne.DALFactory;
using OgilvyOne.IDAL;
namespace OgilvyOne.BLL
{
    public class UsersBll
    {
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="AID"></param>
        /// <returns></returns>
        public bool Exists(string name, int aid)
        {
            return UserFactory.create().Exists(name,aid);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(OgilvyOne.Model.UsersModel model)
        {
            return UserFactory.create().Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(OgilvyOne.Model.UsersModel model)
        {
            return UserFactory.create().Update(model);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int AID)
        {
            return UserFactory.create().Delete(AID);
        }

        public bool DeleteList(string str)
        {
            return UserFactory.create().DeleteList(str);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public OgilvyOne.Model.UsersModel GetModel(int AID)
        {
            return UserFactory.create().GetModel(AID);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public OgilvyOne.Model.UsersModel GetModel(string userName)
        {
            return UserFactory.create().GetModel(userName);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {            ;
           return UserFactory.create().GetList(strWhere);            
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return UserFactory.create().GetList(Top, strWhere, filedOrder);
        }

        //private List<UsersModel> DataTableToList(DataTable dt)
        //{
        //    List<UsersModel> list = new List<UsersModel>();
        //    foreach (DataRow drr in dt.Rows)
        //    {
               
        //    }
        //}
    }
}